package com.ysu.yybk.controller;

import com.ysu.yybk.VO.ResultVO;
import com.ysu.yybk.VO.StudentGetDiscussGroupVO;
import com.ysu.yybk.dto.GroupDTO;
import com.ysu.yybk.service.DiscussStudentService;
import com.ysu.yybk.util.ResultVOUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/student/discuss")
public class DiscussStudentController {

    @Autowired
    private DiscussStudentService studentService;

    @GetMapping("/groups")
    public ResultVO studentGroupList(@RequestParam("discussId") Integer discussId,
                                     @RequestParam("studentId") String studentId) {
        GroupDTO groupDTO = studentService.groupList(discussId, studentId);
        StudentGetDiscussGroupVO vo = new StudentGetDiscussGroupVO();
        BeanUtils.copyProperties(groupDTO, vo);
        return ResultVOUtil.success(vo);
    }
}
